package com.consumer.test;


import com.ai.aif.msgframe.common.IConsumerProcessor;
import com.ai.aif.msgframe.common.exception.ConsumerException;
import com.ai.aif.msgframe.common.message.*;

import java.io.Serializable;

/**
 * 消费实现类
 * 
 * @author guozq5
 *
 */
public class ConsumerProcessorImpl implements IConsumerProcessor
{

	public Object process(MsgFMessage msg) throws ConsumerException 
    {
        // System.out.println(Thread.currentThread().getName());
        if (msg instanceof MsgFTextMessage)
        {
            System.out.println(">>>>>>text>>>>>"
                    + ((MsgFTextMessage) msg).getText());
        }
        else if (msg instanceof MsgFObjectMessage)
        {
            MsgFObjectMessage message = (MsgFObjectMessage) msg;
            System.out
                    .println("<<<<<<_________<" + message.getMsg().toString());
        }
        else if (msg instanceof MsgFMapMessage)
        {
            System.out.println(">>>>>>map>>"
                    + ((MsgFMapMessage) msg).getMapmessage().get("auditData"));
//            AuditInfo inf0 = (AuditInfo) ((MsgFMapMessage) msg).getMapmessage().get("auditData");
        }
        else if (msg instanceof MsgFByteMessage)
        {
            System.out.println(">>>>>>byte>>"
                    + ((MsgFByteMessage) msg).getBytearray());
        }
		return true;

    }

    public Serializable processNeedReturn(MsgFMessage msg)
    {
        // TODO Auto-generated method stub
        return null;
    }

}
